package Demo2;

public class Protectedoutofpackage  {
    public String Question01 = "为什么这个类不可以被继承？因为其中都是protected修饰的成员？";
    protected int a = 12;
    protected void testmethod(){
        System.out.println(a);
    }
//    public static void main(String[] args) {
//        Protectedoutofpackage protectedoutofpackage = new Protectedoutofpackage();
//        protectedoutofpackage.testmethod();
//    }
}
class Son2 extends Protectedoutofpackage{

}
class Test2{
    public static void main(String[] args) {
        Protectedoutofpackage protectedoutofpackage = new Protectedoutofpackage();
        System.out.println(protectedoutofpackage.a);
        protectedoutofpackage.testmethod();
    }
}